package com.wjl.generator;

import com.wjl.mode.MainTemplateConfig;
import freemarker.template.TemplateException;

import java.io.File;
import java.io.IOException;

public class MainGenerator {
    public static void main(String[] args) throws TemplateException, IOException {
        MainTemplateConfig mainTemplateConfig = new MainTemplateConfig();
        mainTemplateConfig.setAuthor("wjl");
        mainTemplateConfig.setLoop(true);
        mainTemplateConfig.setOutputText("测试");
        doGenerate(mainTemplateConfig);
    }
    public static void doGenerate(Object model) throws IOException, TemplateException, IOException, TemplateException {
        String userDir = System.getProperty("user.dir");
        String projectPath = userDir + File.separator + "yuzi-generator-demo-project/acm-template";
        StaticGenerator.copyFilesByRecursive(projectPath,userDir);
        String inputPath=userDir+"/yuzi-generator-basic/src/main/resources/templates/MainTemplate.java.ftl";
        System.out.println(inputPath);
        String outputPath=userDir+"/acm-template/src/com/wjl/acm/MainTemplate.java";

        DynamicGenerator.doGenerate(inputPath,outputPath,model);
    }
}
